<template>
	<view class="details">
		<!-- <view class="d-title">
      {{content.title}}
    </view>
    <view class="d-time">
      {{content.create_time}}
    </view> -->
		<view class="d-rich-text">
			<rich-text :nodes="strings"></rich-text>
		</view>
	</view>
</template>

<script>
	export default {
		// props:{
		//   letterList:Array
		// },
		data() {
			return {
				content: '',
				// strings:''
				strings: '',
				type: ''
			};
		},
		onLoad(option) {
			console.log(option)
			if (option) {
				this.type = option.type
				if (this.type == 1) {
					uni.setNavigationBarTitle({
						title: "隐私政策"
					})
				}
			}
			this.postData();
			// console.log(this.letterList)
			// <img    <img style="width:100%"
		},
		created() {
			// console.log(this.letterList.length)
		},
		methods: {
			postData() {
				this.$api.post(global.apiUrls.agreement)
					.then(res => {
						console.log(res);
						// this.content = res.data.data;
						// console.log(res.data.data.content)
						if (this.type != 1) {
							this.strings = res.data.data.registration_agreement.replace(/\<img/gi, '<img style="width:100%;height:auto"');
						} else {
							this.strings = res.data.data.privacy.replace(/\<img/gi, '<img style="width:100%;height:auto"');
						}
					})
					.catch(err => {
						// this.$popup.showToast('保存失败')
					});
			}
		}
	};
</script>

<style lang="less" scoped>
	.details {
		padding: 32upx;

		.d-title {
			font-size: 32upx;
			color: #333333;
			font-weight: bold;
		}

		.d-time {
			font-size: 24upx;
			color: #999;
			padding: 16upx 0 24upx;
		}

		.d-rich-text {
			line-height: 1.8;

			img {
				width: 100% !important;
			}

			image {
				width: 100% !important;
			}
		}
	}
</style>
